#include <string>
#include <list>
#include <iostream>

using namespace std;

int main()
{
    string word;
    list<char> lst;
    char ch;
    // 从标准输入读取字符
    while (cin >> ch) {
        // 放到容器末尾
        word.push_back(ch); // 等价于 word += ch
        // 放到容器开头
        lst.push_front(ch);
    }
    cout << word << endl;
    for (auto it = lst.begin(); it != lst.end(); ++it)
        cout << *it;
    cout << endl;
}